FRAMEWORK_CUR := $(shell pwd)

CC := gcc
AR := ar
LD := ld

FRAMEWORK_LDFLAG := $(FRAMEWORK_INCLUDE) $(FRAMEWORK_LIBS) $(LOC_LIBS)

LOCAL_SRC := $(shell find ${FRAMEWORK_CUR} -name *.c)
LOCAL_OBJ := $(patsubst %.c,%.o,$(LOCAL_SRC))
TARGET_SO := so
TARGET_BIN := bin

.PHONY:all clean
all: $(TARGET)
$(TARGET):$(LOCAL_OBJ)
	    @echo "===== OBJ $(LOCAL_OBJ) ====="
	    @if [ "so"="$(TARGET_TYPE)" ]; then\
		$(CC) -shared $^ -o $@ $(FRAMEWORK_LDFLAG);\
	    elif [ "bin"="$(TARGET_TYPE)" ]; then\
		$(CC) $^ -o $@ $(FRAMEWORK_LDFLAG);\
	    fi
%.o:%.c
	    @if [ "so"="$(TARGET_TYPE)" ];then\
		$(CC) -shared -fPIC -c $^ -o $@ $(FRAMEWORK_CFLAG) $(FRAMEWORK_LDFLAG);\
	    elif [ "bin"="$(TARGET_TYPE)" ];then\
		$(CC) $^ -o $@ $(FRAMEWORK_CFLAG) $(FRAMEWORK_LDFLAG);\
	    fi

clean: 
	    @rm $(LOCAL_OBJ)
	    @rm $(TARGET)
